package com.jiayinlending.jiayindai.activity.myrepay;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.jiayinlending.jiayindai.R;
import com.jiayinlending.jiayindai.activity.base.BaseActivity;
import com.jiayinlending.jiayindai.adapter.MyLoanRecylerAdpater;
import com.jiayinlending.jiayindai.net.bean.Info;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MyLoanActivity extends BaseActivity {

    @Bind(R.id.recyler_my_loan)
    RecyclerView recylerMyLoan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        initRecyler();
        getToolbarTitle().setText("我的借贷");
        getSubTitle().setText("我的记录");
        getSubTitle().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MyLoanActivity.this,RepaymentRecordActivity.class));
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_loan;
    }

    private void initRecyler() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        recylerMyLoan.setLayoutManager(linearLayoutManager);
        ArrayList<Info> list = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            list.add(new Info());
        }
        recylerMyLoan.setAdapter(new MyLoanRecylerAdpater(this, list));
    }

}
